//
//  WmcTeamMemberSearchView.swift
//  YPWatermarkCamera
//
//  Created by yupao_ios_macmini06 on 2022/9/14.
//

import UIKit

class WmcTeamMemberSearchView: WmcBaseView {
    var placeholder: String? {
        didSet {
            self.inputTextfield.placeholder = placeholder
        }
    }

    override func makeUI() {
        addSubview(bgView)
        bgView.addSubview(searchIcon)
        bgView.addSubview(inputTextfield)
        bgView.addSubview(deleteBtn)
        addSubview(searchBtn)
        addSubview(lineView)

        // let height = (Wmc_screenWidth - 32) * 36/343
        bgView.snp.makeConstraints { make in
            make.top.equalTo(8)
            make.left.equalTo(16)
            make.bottom.equalTo(-8)
            make.right.equalTo(-16)
            make.height.equalTo(36)
        }
        searchIcon.snp.makeConstraints { make in
            make.top.equalTo(9)
            make.left.equalTo(12)
            make.bottom.equalTo(-9)
            make.width.equalTo(searchIcon.snp.height)
        }
        inputTextfield.snp.makeConstraints { make in
            make.left.equalTo(searchIcon.snp.right).offset(3)
            make.centerY.equalTo(searchIcon.snp.centerY)
            make.right.equalTo(-16)
        }
        lineView.snp.makeConstraints { make in
            make.left.right.bottom.equalToSuperview()
            make.height.equalTo(0.5)
        }
    }

    lazy var bgView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.wmc_grayH20_F7F7F7
        view.layer.cornerRadius = 4
        view.clipsToBounds = true
        return view
    }()

    lazy var searchIcon: UIImageView = {
        let view = UIImageView()
        view.image = UIImage(named: "location_search")
        return view
    }()

    lazy var inputTextfield: UITextField = {
        let view = UITextField()
        view.placeholder = "请输入信息"
        return view
    }()

    lazy var deleteBtn: UIButton = {
        let view = UIButton()
        return view
    }()

    lazy var searchBtn: UIButton = {
        let view = UIButton()
        view.titleLabel?.textColor = UIColor.wmc_blue_5290FD
        view.titleLabel?.font = 16.yp.uiFont
        view.titleLabel?.text = "搜索"
        return view
    }()

    lazy var lineView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.wmc_grayH15_E6E6E6
        return view
    }()
}
